$(document).ready(function(e) {
	logincheck();
});
	var jsonserver;
	//jsonserver="http://192.168.6.61:8580/mobile-html5-rest/";
	jsonserver="http://186cloud.com/mobile-html5-rest/";
	//jsonserver="http://192.168.37.116:8089/mobile-html5-rest/";
	//jsonserver="http://bi.911860.com/mobile-html5-rest/";
	var localStr=window.location.href;
	var apkaddres="upgrade/mobile-html5.apk";
	function logincheck(){
		var phonenum=localStorage.getItem("curphone");
		var userkey=localStorage.getItem("userkey");
		if(phonenum==null||phonenum==""||phonenum==" "||userkey==null||userkey==""||userkey==" ") {
			localStorage.clear();
			var url = document.URL;
			if(url != null && url.indexOf("login.html")== -1 && url.indexOf("bespoke-app.html")== -1 ){
				document.location="login.html";

			}
		}
	}
	function errorcheck(errorinfo,errormsg){
		if(errorinfo!="00000"){
			window.localStorage.setItem("errormsg",errormsg);
			window.location.href="error.html";
		}
	}
	
function download(){
	window.open(apkaddres);
}	
function detectDeviceType(){
	var isIphone =navigator.userAgent.indexOf("iPhone") != -1;
	var isIpod = navigator.userAgent.indexOf("iPod") != -1 ;
	var isIpad = navigator.userAgent.indexOf("iPad") != -1 ;
	
	var isAndroid = navigator.userAgent.indexOf("Android") != -1 ;
	var isIos = isIphone || isIpod || isIpad ;
	return isIos?"Apple":"Android";

} 


